package cn.iocoder.yudao.adminserver.franky.single;

import java.util.concurrent.atomic.AtomicLong;

/**
 * @Description:
 * @Author: franky
 * @CreateDate: 2021/4/15 9:34 下午
 * @Version: 1.0
 */

public class IdGeneratorSingleton {
    private AtomicLong id = new AtomicLong(0);
    private IdGeneratorSingleton() {}

    private static class SingletonHolder{
        private static final IdGeneratorSingleton instance = new IdGeneratorSingleton();
    }

    public static IdGeneratorSingleton getInstance() {
        return SingletonHolder.instance;
    }

    public long getId() {
        return id.incrementAndGet();
    }
}